package rules;

import stock.Company;

public class SellRule21 extends Rule {

	private Company merval;
	
	public SellRule21(Company merval) {
		this.merval = merval;
	}

	@Override
	public boolean matches(Company company) {

		boolean mervalDecreasing = (this.merval.getVariation() < 0);
		
		boolean mervalMatchupWithCompany = (mervalDecreasing && (company.getVariation() > 0));
		
		if (mervalMatchupWithCompany){ 
			return this.next(company);
		}
		return false;
	}

}
